package com.dbpms.pj.sys.dao;

import com.dbpms.pj.common.pojo.Node;
import com.dbpms.pj.sys.pojo.SysMenu;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.Map;
import java.util.List;

/**
 * @Author: Song Yu
 * @Date: 2020/10/19 10:17
 */

@Mapper
public interface SysMenuDao {

    List<Map<String,Object>> findObjects();

    @Select("select id,name,parentId from sys_menus")
    List<Node> findZtreeMenuNodes();

    @Select("select count(*) from sys_menus where parentId=#{id}")
    int getChildCount(Integer id);

    @Delete("delete from sys_menus where id=#{id}")
    int deleteObject(Integer id);

    int insertObject(SysMenu entity);

    int updateObject(SysMenu entity);

    List<String> findPermissions(List<Integer> menuIds);

}
